<?php
class Model_LibraryAcl extends Zend_Acl {
	public function __construct() {
		$this->addRole(new Zend_Acl_Role('guest'));
		$this->addRole(new Zend_Acl_Role('guests'));
		$this->addRole(new Zend_Acl_Role('users'), 'guests');
		$this->addRole(new Zend_Acl_Role('admins'), 'users');
		
		
		
		$this->add(new Zend_Acl_Resource('admin'))
		->add(new Zend_Acl_Resource('admin:index'), 'admin')
		->add(new Zend_Acl_Resource('admin:arbre'), 'admin')
		->add(new Zend_Acl_Resource('admin:bassinderetention'), 'admin')
		->add(new Zend_Acl_Resource('admin:Pointbr'), 'admin')
		->add(new Zend_Acl_Resource('admin:Pointgmv'), 'admin')
		->add(new Zend_Acl_Resource('admin:Pointterrain'), 'admin')
		->add(new Zend_Acl_Resource('admin:Pointbassin'), 'admin')
		->add(new Zend_Acl_Resource('admin:terrain'), 'admin')
		->add(new Zend_Acl_Resource('admin:proprietaire'), 'admin');
		
		$this->add(new Zend_Acl_Resource('categorie'))
		->add(new Zend_Acl_Resource('categorie:index'), 'categorie')	 
		->add(new Zend_Acl_Resource('categorie:delete'), 'categorie');	
		
		
		$this->add(new Zend_Acl_Resource('default'))
		->add(new Zend_Acl_Resource('default:authentication'), 'default')
		->add(new Zend_Acl_Resource('default:carte'), 'default')
		->add(new Zend_Acl_Resource('default:index'), 'default')
		->add(new Zend_Acl_Resource('default:admincarte'), 'default')
		->add(new Zend_Acl_Resource('default:matrice'), 'default')
		->add(new Zend_Acl_Resource('default:matricebr'), 'default')
		 ->add(new Zend_Acl_Resource('default:error'), 'default')
		->add(new Zend_Acl_Resource('default:matricegmv'), 'default');
		
		$this->allow('guests', 'default:authentication', array( 'login','logout'));
		
		$this->allow('guests', 'default:carte', 'index');
		$this->allow('guests', 'default:index', 'index');
		$this->allow('guests', 'default:matrice', 'index');
		$this->allow('guests', 'default:admincarte', 'index');
			$this->allow('guests', 'default:error', 'error');
		$this->allow('guests', 'default:matricebr', array ('add','edit','delete', 'allmatricebr', 'index', 'getcoordonnee'));
		$this->allow('guests', 'default:matricegmv', array ('add','edit','delete', 'allmatricegmv', 'index', 'getcoordonnee', 'latitude', 'longitude'));
		$this->allow('guests', 'admin:arbre', array ('add','edit','addIJ', 'delete', 'index', 'getcoordonnee', 'latitude', 'longitude'));
		$this->allow('guests', 'admin:bassinderetention', array ('add','edit', 'delete', 'index','allbassinderetention'));
		$this->allow('guests', 'admin:proprietaire', array ('index','getbr', 'getgmv'));
		$this->allow('guests', 'admin:Pointterrain', 'allpointterrain');
		$this->allow('guests', 'admin:Pointbr', 'allpointbr');
		$this->allow('guests', 'admin:Pointgmv', 'allpointgmv');
		$this->allow('guests', 'admin:Pointbassin', 'allpointbassin');
		$this->allow('guests', 'admin:bassinderetention', 'index');
		$this->allow('guests', 'admin:terrain', 'index');
		
		$this->deny('users', 'default:authentication', 'index');
		$this->allow('users', 'default:index', 'index');
		//$this->allow('users', 'default:authentication', 'logout');
		$this->allow('admins', 'default:carte', 'index');
		
		$this->allow('admins', 'categorie:index', array('index','delete','get'));
		
		
		
	}
}
